//**********************************************************************************
//  PP3_7.java         Author:Tang Caiming
//
//  Prompt the user to input three sides of the triangle, calculate 
//  the three areas of the triangle and keep three decimal places.
//  S stands for the half perimeter of the triangle, and a, b and c represent
//  three sides.
//**********************************************************************************

import java.util.Scanner;
import java.text.DecimalFormat;

public class PP3_7
{
   public static void main(String[] args)
   {
      Scanner scan = new Scanner(System.in);
      
      double s, a, b, c, area;

      System.out.println("Enter the first edge of the triangle: ");
      a = scan.nextDouble();

      System.out.println("Enter the second edge of the triangle: "); 
      b = scan.nextDouble();
    
      System.out.println("Enter the third edge of the triangle: ");
      c = scan.nextDouble();

      s = (a + b + c ) / 2.0;
      area = Math.sqrt(s * (s-a) * (s-b) * (s-c));
       
      DecimalFormat fmt = new DecimalFormat("0.###");

      System.out.println("The area of the triangle is: " + fmt.format(area));
   }
}
